home *** CD-ROM | disk | FTP | other *** search
/ Aminet 31 / Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso / Aminet / util / libs / MailPro.lha / MailProLibrary / include / mail / mailpro.h next >
Encoding:
C/C++ Source or Header  |  1999-03-06  |  14.5 KB  |  264 lines

  1. /*
  2. **      $VER: mailpro.h 1.0 (5.3.99)
  3. **
  4. **      main include file for mailpro.library
  5. **
  6. **      (C) Copyright 1999 Sergeev O.V.
  7. **      All Rights Reserved.
  8. */
  9.  
  10. #ifndef MAIL_MAILPRO_H
  11. #define MAIL_MAILPRO_H
  12.  
  13. #ifndef EXEC_LISTS_H
  14. #include "exec/lists.h"
  15. #endif  /* EXEC_LISTS_H */
  16.  
  17. /* Header of 4D packet which is used at main */
  18. struct PacketHeader
  19. {
  20.   UWORD  ph_OrigNode;    /* Originating node of packet, not of messages in packet */
  21.   UWORD  ph_DestNode;    /* Destination node of packet, not of messages in packet */
  22.   UWORD  ph_Year;        /* Year of packet creation, e.g. 1986                    */
  23.   UWORD  ph_Month;       /* Month of packet creation, 0-11 for Jan-Dec            */
  24.   UWORD  ph_Day;         /* Day of packet creation, 1-31                          */
  25.   UWORD  ph_Hour;        /* Hour of packet creation, 0-23                         */
  26.   UWORD  ph_Minute;      /* Minute of packet creation, 0-59                       */
  27.   UWORD  ph_Second;      /* Second of packet creation, 0-59                       */
  28.   UWORD  ph_Baud;        /* Maximal baud rate of orig and dest                    */
  29.   UWORD  ph_PktVer;      /* PacketType (2); old type (1) packets now obsolete     */
  30.   UWORD  ph_OrigNet;     /* Originating net of packet, not of messages in packet set to -1 if orig = point */
  31.   UWORD  ph_DestNet;     /* Destination net of packet, not of messages in packet  */
  32.   UBYTE  ph_ProdCodeLo;  /* Product Code low byte; 0 for Fido, write to FTSC for others */
  33.   UBYTE  ph_RevisionHi;  /* Binary serial number major byte (otherwise null)      */
  34.   UBYTE  ph_Password[8]; /* Session pasword (null padded)                         */
  35.   UWORD  ph_OrigZone;    /* Originating zone of packet sender (otherwise null)    */
  36.   UWORD  ph_DestZone;    /* Destination zone of packet receiver (otherwise null)  */
  37.   UWORD  ph_AuxNet;      /* Contains OrigNet if Origin is a point                 */
  38.   UWORD  ph_CWValCopy;   /* CWvalidationCopy must be equal to CW to be valid      */
  39.   UBYTE  ph_ProdCodeHi;  /* Product Code high byte                                */
  40.   UBYTE  ph_RevisionLo;  /* Binary serial number minor byte                       */
  41.   UWORD  ph_CapWord;     /* Capabil word                                          */
  42.   UWORD  ph_SZone;       /* Zone of packet sender (otherwise null)                */
  43.   UWORD  ph_RZone;       /* Zone of packet receiver (otherwise null)              */
  44.   UWORD  ph_OrigPoint;   /* Originating point number                              */
  45.   UWORD  ph_DestPoint;   /* Destination point number                              */
  46.   ULONG  ph_Product;     /* Product specific filler                               */
  47. };
  48.  
  49. /* Header of 3D packet */
  50. struct Packet3DHeader
  51. {
  52.   UWORD  ph_OrigNode;    /* Originating node of packet, not of messages in packet */
  53.   UWORD  ph_DestNode;    /* Destination node of packet, not of messages in packet */
  54.   UWORD  ph_Year;        /* Year of packet creation, e.g. 1986                    */
  55.   UWORD  ph_Month;       /* Month of packet creation, 0-11 for Jan-Dec            */
  56.   UWORD  ph_Day;         /* Day of packet creation, 1-31                          */
  57.   UWORD  ph_Hour;        /* Hour of packet creation, 0-23                         */
  58.   UWORD  ph_Minute;      /* Minute of packet creation, 0-59                       */
  59.   UWORD  ph_Second;      /* Second of packet creation, 0-59                       */
  60.   UWORD  ph_Baud;        /* Maximal baud rate of orig and dest; 0=SEA             */
  61.   UWORD  ph_PktVer;      /* PacketType (2); old type (1) packets now obsolete     */
  62.   UWORD  ph_OrigNet;     /* Originating net of packet, not of messages in packet  */
  63.   UWORD  ph_DestNet;     /* Destination net of packet, not of messages in packet  */
  64.   UBYTE  ph_ProdCode;    /* Product Code; 0 for Fido, write to FTSC for others    */
  65.   UBYTE  ph_SerialNo;    /* Binary serial number                                  */
  66.   UBYTE  ph_Password[8]; /* Session pasword (null padded)                         */
  67.   UWORD  ph_OrigZone;    /* Originating zone of packet sender (otherwise null)    */
  68.   UWORD  ph_DestZone;    /* Destination zone of packet receiver (otherwise null)  */
  69.   UBYTE  ph_Pad[20];     /* Not used                                              */
  70. };
  71.  
  72. /* Header of 5D packet */
  73. struct Packet5DHeader
  74. {
  75.   UWORD  ph_OrigNode;    /* Originating node number  */
  76.   UWORD  ph_DestNode;    /* Destination node number  */
  77.   UWORD  ph_OrigPoint;   /* Originating point number - Field only guaranteed accurate in a type 2.2 header */
  78.   UWORD  ph_DestPoint;   /* Destination point number - Field only guaranteed accurate in a type 2.2 header */
  79.   UBYTE  ph_Pad[8];      /* Reserved, must be zero   */
  80.   UWORD  ph_PktSubVer;   /* Packet sub-version (2)   */
  81.   UWORD  ph_PktVer;      /* Packet version (2)       */
  82.   UWORD  ph_OrigNet;     /* Originating network      */
  83.   UWORD  ph_DestNet;     /* Destination network      */
  84.   UBYTE  ph_ProdCode;    /* Product code             */
  85.   UBYTE  ph_Revision;    /* Product revision level   */
  86.   UBYTE  ph_Password[8]; /* Password                 */
  87.   UWORD  ph_OrigZone;    /* Originating zone - Field only guaranteed accurate in a type 2.2 header         */
  88.   UWORD  ph_DestZone;    /* Destination zone - Field only guaranteed accurate in a type 2.2 header         */
  89.   UBYTE  ph_OrigDom[8];  /* Originating domain - Field only guaranteed accurate in a type 2.2 header       */
  90.   UBYTE  ph_DestDom[8];  /* Destination domain - Field only guaranteed accurate in a type 2.2 header       */
  91.   ULONG  ph_Product;     /* Product specific data    */
  92. };
  93.  
  94. /* Mail packet structure */
  95. struct MailPacket
  96. {
  97.   struct Node          mp_Node;      /* mp_Node.ln_Name shows on mp_Name  */
  98.   UBYTE                mp_Name[256]; /* the name of packet without path   */
  99.   ULONG                mp_Type;      /* type of mail packet; see bellow   */
  100.   ULONG                mp_Status;    /* status of mail packet; see bellow */
  101.   ULONG                mp_Size;      /* the length of mail packet         */
  102.   ULONG                mp_NumMess;   /* the number of messages in packet  */
  103.   struct PacketHeader *mp_Header;    /* header of mail packet             */
  104.   struct MinList       mp_Messages;  /* list of messages                  */
  105.   ULONG                mp_UserData;  /* for external (user's) usage       */
  106. };
  107.  
  108. /* Header of message */
  109. struct MessageHeader
  110. {
  111.   UWORD  mh_Version;     /* Message type (2); old type (1) is obsolete       */
  112.   UWORD  mh_OrigNode;    /* Originating node of message                      */
  113.   UWORD  mh_DestNode;    /* Destination node of message                      */
  114.   UWORD  mh_OrigNet;     /* Originating network of message                   */
  115.   UWORD  mh_DestNet;     /* Destination network of message                   */
  116.   UWORD  mh_Attr;        /* Message attributes - see below                   */
  117.   UWORD  mh_Cost;        /* In lowest unit of originator's currency          */
  118. };
  119.  
  120. /* Mail message */
  121. struct MailMessage
  122. {
  123.   struct MinNode        mm_MNode;       /* for link into messages list       */
  124.   ULONG                 mm_Size;        /* the length of message             */
  125.   ULONG                 mm_Status;      /* status of message; see bellow     */
  126.   ULONG                 mm_NumEntries;  /* the number of entries in message  */
  127.   struct MessageHeader *mm_Header;      /* header of message                 */
  128.   struct MinList        mm_Entries;     /* list of entries                   */
  129.   ULONG                 mm_Flags;       /* private field - do NOT modify it! */
  130. };
  131.  
  132. /* Entry of message */
  133. struct MessageEntry
  134. {
  135.   struct MinNode me_MNode;              /* for link into entries list        */
  136.   ULONG          me_ID;                 /* identifier of entry; see below    */
  137.   ULONG          me_Size;               /* the length of entry               */
  138.   STRPTR         me_Entry;              /* the contents of entry             */
  139.   ULONG          me_Flags;              /* private field - do NOT modify it! */
  140. };
  141.  
  142. /* Archiver's descriptor */
  143. struct ArchiverNode
  144. {
  145.   struct Node            an_Node;      /* for link into archivers' list             */
  146.   STRPTR                 an_Seq;       /* String by which archiver will be detected */
  147.   STRPTR                 an_Pack;      /* String for pack files into archive        */
  148.   STRPTR                 an_UnPack;    /* String for unpack archive                 */
  149. };
  150.  
  151. /* usefull macroses */
  152. #define MAKE_ID(a,b,c,d)  ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
  153.  
  154.  
  155. /* Attributes' flags for mh_Attr in Message Header */
  156. #define MSGPRIVATE  0x0001    /* Private message              */
  157. #define MSGCRASH    0x0002    /* Crash priority message       */
  158. #define MSGREAD     0x0004    /* Read by addressee            */
  159. #define MSGSENT     0x0008    /* Sent okay                    */
  160. #define MSGFILE     0x0010    /* file attached                */
  161. #define MSGFWD      0x0020    /* being forwarded              */
  162. #define MSGORPHAN   0x0040    /* Unknown destination          */
  163. #define MSGKILL     0x0080    /* Kill after mailing           */
  164. #define MSGLOCAL    0x0100    /* TRUE if message entered here */
  165. #define MSGHOLD     0x0200    /* TRUE if hold for pickup      */
  166. #define MSGX2       0x0400    /* reserved -- sent             */
  167. #define MSGFREQ     0x0800    /* Requesting a file            */
  168. #define MSGRREQ     0x1000    /* Return Receipt requested     */
  169. #define MSGRRCT     0x2000    /* Return Receipt               */
  170. #define MSGAREQ     0x4000    /* Request audit trail          */
  171. #define MSGUREQ     0x8000    /* Requesting a file update     */
  172.  
  173. /* type of mail packet for mp_Type */
  174. #define MPT_UNKNOWN                  0L
  175. #define MPT_3D                       MAKE_ID('3','D',' ',' ')
  176. #define MPT_4D                       MAKE_ID('4','D',' ',' ')
  177. #define MPT_5D                       MAKE_ID('5','D',' ',' ')
  178.  
  179. /* status of mail packet for mp_Status */
  180. #define MPS_OK                       0L  /* There are no errors in packet   */
  181. #define MPS_CORRUPTED                1L  /* Packet is too short             */
  182. #define MPS_EMPTY                    2L  /* Packet hasn't any messages      */
  183.  
  184. /* status of mail message for mm_Status */
  185. #define MMS_OK                       0L  /* There are no errors in message  */
  186. #define MMS_CORRUPTED                1L  /* Message is too short            */
  187. #define MMS_EMPTY                    2L  /* Message hasn't any entries      */
  188.  
  189. /* Identifiers of recognized messages' entries */
  190.  
  191. /* main entries: */
  192. #define MEID_DATE            MAKE_ID('D','A','T','E') /* Date of message    */
  193. #define MEID_FROM            MAKE_ID('F','R','O','M') /* Sender of message  */
  194. #define MEID_TO              MAKE_ID('T','O',' ',' ') /* Message receiver   */
  195. #define MEID_SUBJ            MAKE_ID('S','U','B','J') /* Subject of message */
  196. #define MEID_AREA            MAKE_ID('A','R','E','A') /* AREA:              */
  197. #define MEID_BODY            MAKE_ID('B','O','D','Y') /* Message body       */
  198.  
  199. /* main kludges */
  200. #define MEID_KL_DOMAIN       MAKE_ID('D','O','M','N') /* DOMAIN    */
  201. #define MEID_KL_FMPT         MAKE_ID('F','M','P','T') /* FMPT      */
  202. #define MEID_KL_TOPT         MAKE_ID('T','O','P','T') /* TOPT      */
  203. #define MEID_KL_MSGID        MAKE_ID('M','S','I','D') /* MSGID:    */
  204. #define MEID_KL_PID          MAKE_ID('P','I','D',' ') /* PID:      */
  205. #define MEID_KL_REPLY        MAKE_ID('R','P','L','Y') /* REPLY:    */
  206. #define MEID_KL_CHRS         MAKE_ID('C','H','R','S') /* CHRS:     */
  207. #define MEID_KL_TID          MAKE_ID('T','I','D',' ') /* TID:      */
  208. #define MEID_KL_INTL         MAKE_ID('I','N','T','L') /* INTL      */
  209. #define MEID_KL_PATH         MAKE_ID('P','A','T','H') /* PATH:     */
  210. #define MEID_KL_REALNAME     MAKE_ID('R','N','A','M') /* REALNAME: */
  211. #define MEID_KL_GIF          MAKE_ID('G','I','F',' ') /* GIF:      */
  212. #define MEID_KL_EID          MAKE_ID('E','I','D',' ') /* EID       */
  213. #define MEID_KL_VIA          MAKE_ID('V','I','A',' ') /* Via       */
  214.  
  215. /* i-net gate kludges */
  216. #define MEID_KL_XMAILER      MAKE_ID('X','M','L','R') /* X-Mailer:       */
  217. #define MEID_KL_REPLYADDR    MAKE_ID('R','P','L','A') /* REPLYADDR       */
  218. #define MEID_KL_INREPLYTO    MAKE_ID('I','R','T','O') /* In-Reply-To:    */
  219. #define MEID_KL_RFC_PATH     MAKE_ID('R','P','T','H') /* RFC-Path:       */
  220. #define MEID_KL_RFC_REF      MAKE_ID('R','R','E','F') /* RFC-References: */
  221.  
  222. /* MIME compression kludges */
  223. #define MEID_KL_MIMEVERSION  MAKE_ID('M','I','M','V') /* MIME-Version:              */
  224. #define MEID_KL_CONTENTTYPE  MAKE_ID('C','N','T','T') /* Content-Type:              */
  225. #define MEID_KL_CONTENTTREN  MAKE_ID('C','N','T','E') /* Content-Transfer-Encoding: */
  226. #define MEID_KL_RFC_MIMEVER  MAKE_ID('R','M','I','V') /* RFC-Path:                  */
  227. #define MEID_KL_RFC_CONTYPE  MAKE_ID('R','C','N','T') /* RFC-Content-Type:          */
  228.  
  229. /* special identifiers */
  230. #define MEID_ENTRY_CORRUPTED MAKE_ID('C','R','P','T') /* bad entry      */
  231. #define MEID_ENTRY_EMPTY     MAKE_ID('E','M','P','T') /* empty entry    */
  232. #define MEID_ENTRY_UNKNOWN   MAKE_ID('U','N','K','N') /* unknown kludge */
  233.  
  234. /* Special values for pattern in MP_IsFile() */
  235. /* for pattern: */
  236. #define MPISFP_DONT_USE              ((STRPTR)0)
  237. #define MPISFP_SIMPLE_PACKET         ((STRPTR)1)
  238. #define MPISFP_SIMPLE_PACKET_SUFFIX  ((STRPTR)2)
  239. #define MPISFP_PACKED_PACKET         ((STRPTR)3)
  240. #define MPISFP_PACKED_PACKET_SUFFIX  ((STRPTR)4)
  241. #define MPISFP_FILE_LIST             ((STRPTR)5)
  242. #define MPISFP_TIC_FILE              ((STRPTR)6)
  243. #define MPISFP_RDM_FILE              ((STRPTR)7)
  244.  
  245. /* for mailtype: */
  246. #define MPISFT_DONT_USE              0L
  247. #define MPISFT_PKT           MAKE_ID('T','P','K','T')
  248. #define MPISFT_BINARY        MAKE_ID('T','B','I','N')
  249. #define MPISFT_TEXT          MAKE_ID('T','T','X','T')
  250.  
  251. /* error codes (returned by some functions) */
  252. #define MP_ERROR_OUT_OF_MEMORY       -1L /* Not enough memory                              */
  253. #define MP_ERROR_CANT_OPEN_FILE      -2L /* DOS Open() fault                               */
  254. #define MP_ERROR_CANT_EXAM_FILE      -3L /* DOS ExamineFH() fault                          */
  255. #define MP_ERROR_CANT_READ_FILE      -4L /* DOS Read() fault                               */
  256. #define MP_ERROR_CANT_WRITE_FILE     -5L /* DOS Write() fault                              */
  257. #define MP_ERROR_CANT_LOCK_DIR       -6L /* DOS Lock() fault                               */
  258. #define MP_ERROR_CANT_EXAM_DIR       -7L /* DOS Examine() or ExNext() fault                */
  259. #define MP_ERROR_CANT_PARSE_PATTERN  -8L /* DOS ParsePatternNoCase() fault                 */
  260. #define MP_ERROR_ARCHIVER_NOT_FOUND  -9L /* Needed archiver was not found in archiver list */
  261. #define MP_ERROR_CANT_RUN_SHELL     -10L /* DOS SystemTags() returned -1                   */
  262.  
  263. #endif /* MAIL_MAILPRO_H */
  264.